﻿<%@ Page Title="" Language="C#" MasterPageFile="~/App_Master/AdminMaster2.master" AutoEventWireup="true"
    CodeFile="LotteryBuyMyself.aspx.cs" Inherits="LotteryBuyMyself" %>

<%@ Register Assembly="AspNetPager" Namespace="Wuqi.Webdiyer" TagPrefix="webdiyer" %>

<asp:Content ID="Content1" ContentPlaceHolderID="head" runat="Server">
</asp:Content>
<asp:Content ID="Content2" ContentPlaceHolderID="ContentPlaceHolder1" runat="Server">
    <div class="apply">
        <div class="apply2">
            <%--<uc_left_m:left_menu ID="left_m1" runat="server" />--%>
            <div class="myul_r">
                <div class="mod_pad4">
                    <div class="hd_admin">
                        <strong>自购彩票信息，确认开奖后请记得派奖</strong>
                        &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 
                    </div>
                    <div class="admin_tab_box1">
                        <br />
                        <label class="bold green1">请选择种类：</label>
                        <asp:dropdownlist runat="server" id="caipiaoType" autopostback="true" onselectedindexchanged="caipiaoType_SelectedIndexChanged">
                        <asp:ListItem Value="1">双色球</asp:ListItem> 
                        <asp:ListItem Value="2">大乐透</asp:ListItem> 
                        <asp:ListItem Value="3">排列三</asp:ListItem> 
                        <asp:ListItem Value="4">排列五</asp:ListItem> 
                        <asp:ListItem Value="5">福彩3D</asp:ListItem> 
                        <asp:ListItem Value="6">七星彩</asp:ListItem> 
                        <asp:ListItem Value="7">七乐彩</asp:ListItem>
                        </asp:dropdownlist>
                        请输入期数：<asp:textbox runat="server" maxlength="7" id="TextQS"></asp:textbox>
                        <asp:button runat="server" text="查询" onclick="Unnamed2_Click" />
                        &nbsp;<asp:button id="exportBtn" runat="server" text="导出"
                            onclick="exportBtn_Click" /><br />
                        <br />
                        注意：开始派奖之前请选择彩票类型，以及输入派奖期数，并且点击查询按钮后，方可派奖.<br />
                        <br />
                        <input type="button" id="startSystem" value="开始系统派奖" onclick="javascript:startSystem_Click(<%=type %>,<%=qs %>)" />
                        <div class="clear"></div>
                        <div class="coupons">
                            <table class="w top20" width="1060" border="0" cellspacing="0" cellpadding="0">
                                <tr class="t">
                                    <td style="width: 200px;">用户编号</td>
                                    <td style="width: 300px;">期数</td>
                                    <td style="width: 260px;">倍数</td>
                                    <td style="width: 500px;">购买号码</td>
                                    <td style="width: 200px;">是否已派奖</td>
                                </tr>
                                <%if (lottery != null && lottery.Count > 0)
                                    { %>
                                <%for (int k = 0; k < lottery.Count; k++)
                                    { %>
                                <tr>
                                    <td style="width: 209px;"><%=lottery[k].User_id%></td>
                                    <td style="width: 243px;">第<%=lottery[k].LotteryQs%>期</td>
                                    <td style="width: 260px;"><%=lottery[k].LotteryMultiple%></td>
                                    <td style="width: 500px;"><%=Bind(lottery[k].id)%></td>
                                    <td style="width: 200px;"><%=lottery[k].Flag==false?"未派奖":"已派奖"%></td>
                                </tr>
                                <%} %>
                                <%}
                                    else
                                    { %>
                                <tr>
                                    <td colspan="6" style="width: 1060px;">
                                        <div class='no_data'>^_^&nbsp;&nbsp;没有符合条件的数据！</div>
                                    </td>
                                </tr>
                                <%} %>
                            </table>
                        </div>

                        <div style="text-align: center">
                            <webdiyer:AspNetPager SubmitButtonClass="buttons" ID="AspNetPager1"
                                runat="server" AlwaysShow="True" FirstPageText="首页"
                                NextPageText="下一页" PrevPageText="前一页" LastPageText="尾页" PageSize="10"
                                OnPageChanged="AspNetPager1_PageChanged">
                            </webdiyer:AspNetPager>
                        </div>
                    </div>
                </div>
            </div>
        </div>
    </div>
    <script type="text/javascript">
        function startSystem_Click(lotteryType, lotteryQs) {
            if (lotteryType == 0) {
                alert("请选择彩票类型！");
                return;
            } else if (lotteryQs == "2014000") {
                alert("请输入期数,并点击查询按钮！");
                return;
            } else {
                if (confirm("由于数据过多，系统派奖时间会很长，请不要重复点击，请您确认后耐心等待...")) {
                    $.post("/Ajax/SubmitWin.aspx", { type: lotteryType, qs: lotteryQs }, function (data) {
                        if (data == "success") {
                            alert("派奖成功，请查看！");
                        }
                        else {
                            alert("派奖失败,请核对您输入的信息是否正确！");
                        }
                    }, "text");
                }
            }
        }
    </script>
    <script language="javascript" type="text/javascript">
        var obj, j;
        var page = 0;
        var nowPage = 0; //当前页
        var listNum = 6; //每页显示<ul>数
        var PagesLen; //总页数
        var PageNum = 4; //分页链接接数(5个)
        onload = function () {
            obj = document.getElementById("www_zzjs_net").getElementsByTagName("tr");
            j = obj.length
            PagesLen = Math.ceil(j / listNum);
            upPage(0)
        }
        function upPage(p) {
            nowPage = p
            //内容变换
            for (var i = 0; i < j; i++) {
                obj[i].style.display = "none"
            }
            for (var i = p * listNum; i < (p + 1) * listNum; i++) {
                if (obj[i]) obj[i].style.display = "block"
            }
            //分页链接变换
            strS = '<a href="###" onclick="upPage(0)">首页</a>  '
            var PageNum_2 = PageNum % 2 == 0 ? Math.ceil(PageNum / 2) + 1 : Math.ceil(PageNum / 2)
            var PageNum_3 = PageNum % 2 == 0 ? Math.ceil(PageNum / 2) : Math.ceil(PageNum / 2) + 1
            var strC = "", startPage, endPage;
            if (PageNum >= PagesLen) { startPage = 0; endPage = PagesLen - 1 }
            else if (nowPage < PageNum_2) { startPage = 0; endPage = PagesLen - 1 > PageNum ? PageNum : PagesLen - 1 } //首页
            else { startPage = nowPage + PageNum_3 >= PagesLen ? PagesLen - PageNum - 1 : nowPage - PageNum_2 + 1; var t = startPage + PageNum; endPage = t > PagesLen ? PagesLen - 1 : t }
            for (var i = startPage; i <= endPage; i++) {
                if (i == nowPage) strC += '<a href="###" style="color:red;font-weight:700;" onclick="upPage(' + i + ')">' + (i + 1) + '</a> '
                else strC += '<a href="###" onclick="upPage(' + i + ')">' + (i + 1) + '</a> '
            }
            strE = ' <a href="###" onclick="upPage(' + (PagesLen - 1) + ')">尾页</a>  '
            strE2 = nowPage + 1 + "/" + PagesLen + "页" + "  共" + j + "条"
            document.getElementById("changpage").innerHTML = strS + strC + strE + strE2
        }
    </script>
</asp:Content>
